#!/usr/bin/env python3
#coding:utf-8

import os
import sys
import re
import shutil



def appendFile(filename,str):
     f=open(filename,'r')
     infile=0
     for line in f:
	     if line.strip()==str :
	          infile=1
	          break 
     f.close()
     if infile==0:
        f=open(filename,'a')
        f.write("\n"+str)
        f.close()
	 
	 
def ldsoconf():
    appendFile('/etc/ld.so.conf','/usr/local/lib')
    appendFile('/etc/ld.so.conf','/usr/local/lib64')
   # appendFile('/etc/ld.so.conf','/opt/ffmpeg/lib')


#os.system("yum -y install epel-release gcc gcc-c++ glibc glibc-devel make nasm pkgconfig lib-devel openssl-devel expat-devel gettext-devel libtool mhash.x86_64 perl-Digest-SHA1.x86_64 zip unzip patch ghostscript automake")
#os.system("sudo ln -s /usr/bin/automake /usr/bin/automake-1.15")
#os.system("sudo ln -s /usr/bin/aclocal /usr/bin/aclocal-1.15")
#os.system("yum -y install log4cplus")

os.chdir("nginx-1.23.4")
os.system("./configure   --prefix=/usr/local/goodStream --sbin-path=sbin/goodStream --conf-path=conf/goodStream.conf --pid-path=logs/goodStream.pid --lock-path=logs/goodStream.lock  --with-pcre=../pcre-8.40  --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.1.0e --with-http_dav_module  --with-ipv6  --with-http_mp4_module  --with-http_stub_status_module --with-http_gzip_static_module --with-http_ssl_module   --add-module=../nginx-rtmp-module --add-dynamic-module=../nginx-accesskey  ")
os.system("make ")
os.system("make install")
#os.chdir("..")

#os.system("cp goodStream.conf /usr/local/goodStream/conf")
#os.system("cp goodStream.service /etc/systemd/system/goodStream.service")
#os.system("chkconfig goodStream on")
print("install Sucess!")






